package com.clement.filter;

import javax.servlet.*;
import java.io.IOException;

/**
 * Created by Clement on 2017/4/6.
 */
public class HelloFilter implements Filter {

    private FilterConfig filterConfig;

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        this.filterConfig = filterConfig;
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        String value = filterConfig.getInitParameter("name");
        request.setAttribute("name",value);
        chain.doFilter(request, response);
    }

    @Override
    public void destroy() {

    }
}
